package org.dflt;

import org.MenuTreeItem;
import org.swing.JModalInternalFrame;

import javax.swing.*;

/**
 * Created by babitsky.viacheslav
 * Date: 18.01.2008
 * Time: 22:48:44
 */
public class DefaultMenuTreeItem implements MenuTreeItem{
    private Integer id;
    private Integer ownerID;
    private Class<? extends JModalInternalFrame> frameClass;
    private String menuItemName;
    private Icon menuItemIcon;
    private KeyStroke accelerator;

    public DefaultMenuTreeItem(Integer id, Integer ownerID, Class<? extends JModalInternalFrame> frameClass, String menuItemName, Icon menuItemIcon, KeyStroke accelerator) {
        this.accelerator = accelerator;
        this.frameClass = frameClass;
        this.id = id;
        this.menuItemIcon = menuItemIcon;
        this.menuItemName = menuItemName;
        this.ownerID = ownerID;
    }

    /**
     * Menue ID, need for build menu tree
     *
     * @return MenuItem ID
     */
    public Integer getID() {
        return id;
    }

    /**
     * Parent menue ID
     *
     * @return MenuItem ID, if null - no parent
     */
    public Integer getOwnerID() {
        return ownerID;
    }

    /**
     * Returns the class, which opening with MenuItem.
     *
     * @return class extends JModalInternalFrame
     */
    public Class<? extends JModalInternalFrame> getFrameClass() {
        return frameClass;
    }

    /**
     * Returns the MenuItem's text.
     *
     * @return the MenuItem text
     */
    public String getMenuItemName() {
        return menuItemName;
    }

    /**
     * Returns the icon.
     *
     * @return the <code>Icon</code>
     */
    public Icon getMenuItemIcon() {
        return menuItemIcon;
    }

    /**
     * Returns the <code>KeyStroke</code> which serves as an accelerator
     * for the menu item.
     *
     * @return a <code>KeyStroke</code> object identifying the
     *         accelerator key
     */
    public KeyStroke getAccelerator() {
        return accelerator;
    }
}
